//
//  MHHTTPService+Live.m
// MiaoCircle
//
//Created by acgera on 2018/4/9.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHHTTPService+Login.h"
#import "MHFuInfoUserModel.h"
#import "MHH5Links.h"
@implementation MHHTTPService (Login)

//第三方登录
-(RACSignal *) thirdPartLoginWithPlatform:(MHUserLoginChannelType ) type appId:(int) appId openId:(NSString *)openId  unionId:(NSString *) unionId token:(NSString *) token nickName:(NSString *)nickName headImagUrl:(NSString *) headImageUrl
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"platform"] = @(type);
    subscript[@"appId"] = @(appId);
    subscript[@"openId"] = openId;
    subscript[@"unionId"] = unionId;
    subscript[@"token"] = token;
    subscript[@"nickName"] = nickName;
    subscript[@"headImgUrl"] = headImageUrl;
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_PROFILE_LOGINTHIRD parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
             enqueueResultClass:[MHUser class]];
}

-(RACSignal *) loginByToken
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_PROFILE_LOGINBYTOKEN parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHUser class]];
    
}




-(RACSignal *) fetchUserFullInfoWith:(int) userId;
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"userId"] = @(userId);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_PROFILE_LOGINTHIRD parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHFuInfoUserModel class]];
}

-(RACSignal *) modifyUserInfo
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
//    subscript[@"userId"] = @(userId);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_PROFILE_LOGINTHIRD parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHFuInfoUserModel class]];
}

-(RACSignal *) getH5LinkList
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_PROFILE_GETH5LINKLIST parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHH5Links class]];
}


@end
